]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell/global: Remove repaint funcs on shutdown
authorSebastian Keller <skeller@gnome.org>
Sun, 1 Mar 2026 23:46:56 +0000 (00:46 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 14 Mar 2026 17:40:12 +0000 (18:40 +0100)
This fixes a small leak caused by those functions remaining in the
`ClutterContext` `repaint_funcs` list otherwise.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4098>
(cherry picked from commit e5381ef528284a914dd5b4c59ab97e523ebfdcba)

src/shell-global.c

index 9a6de28e98f99d60c043eacd79631e7e2d4f2b42..72e837a9334f20f11f11e24be7ad2df73f5c5a91 100644 (file)
@@ -89,6 +89,9 @@ struct _ShellGlobal {
   gboolean frame_timestamps;
   gboolean frame_finish_timestamp;
 
+  guint before_paint_id;
+  guint after_swap_id;
+
   GDBusProxy *switcheroo_control;
   GCancellable *switcheroo_cancellable;
 
@@ -468,6 +471,11 @@ shell_global_finalize (GObject *object)
   g_clear_object (&global->app_cache);
   g_clear_object (&global->app_usage);
 
+  g_clear_handle_id (&global->before_paint_id,
+                     clutter_threads_remove_repaint_func);
+  g_clear_handle_id (&global->after_swap_id,
+                     clutter_threads_remove_repaint_func);
+
   the_object = NULL;
 
   g_cancellable_cancel (global->switcheroo_cancellable);
@@ -1056,16 +1064,18 @@ _shell_global_set_plugin (ShellGlobal *global,
   g_signal_connect (global->stage, "notify::height",
                     G_CALLBACK (global_stage_notify_height), global);
 
-  clutter_threads_add_repaint_func (CLUTTER_REPAINT_FLAGS_PRE_PAINT,
-                                    global_stage_before_paint,
-                                    global, NULL);
+  global->before_paint_id =
+    clutter_threads_add_repaint_func (CLUTTER_REPAINT_FLAGS_PRE_PAINT,
+                                      global_stage_before_paint,
+                                      global, NULL);
 
   g_signal_connect (global->stage, "after-paint",
                     G_CALLBACK (global_stage_after_paint), global);
 
-  clutter_threads_add_repaint_func (CLUTTER_REPAINT_FLAGS_POST_PAINT,
-                                    global_stage_after_swap,
-                                    global, NULL);
+  global->after_swap_id =
+    clutter_threads_add_repaint_func (CLUTTER_REPAINT_FLAGS_POST_PAINT,
+                                      global_stage_after_swap,
+                                      global, NULL);
 
   shell_perf_log_define_event (shell_perf_log_get_default(),
                                "clutter.stagePaintStart",